﻿mainModule.factory("BaseApiSvc", ["$http", "notification", function ($http, notification) {
    "use strict";
    var BaseApiSvc = function(url){
        this.url = url;
    }
    BaseApiSvc.prototype = {
        findBy: function (query) {
            return $http.post(this.url + "searches", query);
        },

        findById: function (id) {
            return $http.get(this.url + id);
        },

        edit: function (item) {
            return $http.put(this.url + item.Id, item);
        },

        add: function (item) {
            return $http.post(this.url, item);
        },

        remove: function (id) {
            return $http.delete(this.url + id);
        }
    };
    return BaseApiSvc;
}]);